<div class="modal fade " id="objectNameAddModal"   role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 30%">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">表信息</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal" >
                <div class="box-body">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">表名</label>
                        <div class="col-sm-7">
                            <input id="objectNameAddModal_objectName" type="text" class="form-control" readonly="readonly">
                            <input id="objectNameAddModal_id" type="hidden" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">名称</label>
                        <div class="col-sm-7">
                            <input id="objectNameAddModal_name" type="text" class="form-control">
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"  >取消</button>

                    <button type="button" class="btn btn-primary pull-right" onclick="objectNameAddModal_save()">保存</button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>
    $(".select2").select2();

    function objectNameAddModalInit() {
        $("#objectNameAddModal_objectName").val("");
        $("#objectNameAddModal_id").val("");
        $("#objectNameAddModal_name").val("");
    }

    function objectNameAddModalSetValue(index) {
        var data = $("#table1").bootstrapTable("getData")[index] ;
        $("#objectNameAddModal_objectName").val(data.objectName);
        $("#objectNameAddModal_id").val(data.id);
        $("#objectNameAddModal_name").val(data.name);
    }

    function objectNameAddModal_save() {
        var data = {
            name:$("#objectNameAddModal_name").val(),
            id:$("#objectNameAddModal_id").val()
        };
        var url = "/databaseobject/modify" ;
        postReq(url,data,function(result){
            if (result.success) {
                toastr['success']('操作成功', '提示');
                $("#table1").bootstrapTable("refresh");
                $("#objectNameAddModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        }) ;

    }
</script>